/*
 * All right reserved@Raygo 2022~2030
 */

package com.raygo.runner.core.entity;

import java.util.ArrayList;
import java.util.List;

import com.raygo.runner.core.result.BoolResult;

/**
 * 一组步骤项组
 *
 * @author Raygo
 * @since 2022年5月21日
 */
public class Group implements Module {
    /**
     * 组名称
     */
    private String name;

    /**
     * 步骤项列表
     */
    private final List<Step> stepItems = new ArrayList<>();

    /**
     * 是否关键组
     */
    private boolean key = true;

    /**
     * 串行或并行
     */
    private boolean runInSerial = true;

    /**
     * 类型
     */
    private GroupType type = GroupType.NORMAL;

    @Override
    public BoolResult init() {
        return new BoolResult();
    }

    @Override
    public BoolResult exit() {
        return new BoolResult();
    }

    /**
     * 名称构造
     *
     * @param name 名称
     */
    public Group(String name) {
        this.name = name;
    }

    /**
     * 添加步骤项
     *
     * @param item 步骤项
     */
    public void addStep(Step item) {
        stepItems.add(item);
    }

    /**
     * Get groupName value
     *
     * @return the groupName
     */
    public String getName() {
        return name;
    }

    /**
     * Set groupName to groupName
     *
     * @param name the groupName to set
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * Get runInSerial value
     *
     * @return the runInSerial
     */
    public boolean isRunInSerial() {
        return runInSerial;
    }

    /**
     * Set runInSerial to runInSerial
     *
     * @param runInSerial the runInSerial to set
     */
    public void setRunInSerial(boolean runInSerial) {
        this.runInSerial = runInSerial;
    }

    /**
     * Get stepItems value
     *
     * @return the stepItems
     */
    public List<Step> getStepItems() {
        return stepItems;
    }

    /**
     * Get key value
     *
     * @return the key
     */
    public boolean isKey() {
        return key;
    }

    /**
     * Set key to key
     *
     * @param key the key to set
     */
    public void setKey(boolean key) {
        this.key = key;
    }

    /**
     * Get type value
     *
     * @return the type
     */
    public GroupType getType() {
        return type;
    }

    /**
     * Set type to type
     *
     * @param type the type to set
     */
    public void setType(GroupType type) {
        this.type = type;
    }
}
